org-page

static site generator

Emacs Lisp

常用函数速查

nth

(nth N LIST)

返回 LIST 的第 N 个元素。 N0 开始。若 N 大于 LIST 的长度,则返回 nil 。 如果 N 是一个负数,则返回 LIST 的第一个元素。

(nth n x) == (car (nthcdr n x))

Example:

(nth 0 '(a b c)) ;==> a
(nth 2 '(a b c)) ;==> c
(nth 4 '(a b c)) ;==> nil
(nth -1 '(a b c)) ;==> a

Comments

comments powered by Disqus